﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="backstage_group_send_message" Codebehind="group_send_message.aspx.cs" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>
        群发消息
    </title>
    <link href="css/skin.css" rel="stylesheet" type="text/css" />
</head>

<script type="text/javascript" src="js/main.js"></script>

<script type="text/javascript" src="js/jquery.min.js"></script>

<script type="text/javascript" src="js/jquery.js"></script>

<script type="text/javascript">
    $(function () {
        var sc = document.getElementById("selectUser");
        var sac = document.getElementById("selectAddUser");
        $("#btnAllAdd").click(function () {
            for (var i = 0; i < sc.options.length; i++) {
                var rs = false;
                for (var j = 0; j < sac.options.length; j++) {
                    if (sac.options[j].value == sc.options[i].value)
                        rs = true;
                }
                if (!rs) {
                    var selectItem = new Option();
                    selectItem.text = sc.options[i].text;
                    selectItem.value = sc.options[i].value
                    sac.options.add(selectItem);
                }
            }
        });
        $("#btnAdd").click(function () {
            for (var i = 0; i < sc.options.length; i++) {
                if (sc.options[i].selected) {
                    var rs = false;
                    for (var j = 0; j < sac.options.length; j++) {
                        if (sac.options[j].value == sc.options[i].value)
                            rs = true;
                    }
                    if (!rs) {
                        var selectItem = new Option();
                        selectItem.text = sc.options[i].text;
                        selectItem.value = sc.options[i].value
                        sac.options.add(selectItem);
                    }
                }
            }

        });
        $("#btnDelete").click(function () {
            for (var i = (sac.options.length - 1); i > -1; i--) {
                if (sac.options[i].selected) {
                    sac.options.remove(i);
                }

            }
        });
        $("#btnAllDelete").click(function () {
            for (var i = (sac.options.length - 1); i > -1; i--) {
                sac.options.remove(i);
            }
        });
        $("#btnSubmit").click(function () {
            if (sac.options.length == 0) {
                alert("请至少选择一个收件人！");
                document.getElementById("selectAddUser").focus();
                return false;
            }
            if ($("#txtTitle").val() == "") {
                alert("请输入标题！");
                $("#txtTitle").focus();
                return false;
            }
            if ($("#txtaContent").value == "") {
                alert("请输入内容！");
                $("#txtaContent").focus();
                return false;
            }
            else {
                if ($("#txtaContent").val().length > 4000) {
                    alert("内容最多不能超过4000个字符！");
                    $("#txtaContent").select();
                    return false;
                }
            }
            for (var z = 0; z < sac.options.length; z++) {
                sac.options[z].selected = true;
            }
            return true;
        });
    });
</script>

<body class="body">
    <table class="main" cellpadding="0" cellspacing="0">
        <tr>
            <td class="td_left_top">
                <img alt="" src="images/left-top-right.gif" /></td>
            <td class="td_middle_top">
                <div class="left_topbg">
                    <div class="titlebt">
                        群发消息
                    </div>
                </div>
            </td>
            <td class="td_right_top">
                <img alt="" src="images/nav-right-bg.gif" /></td>
        </tr>
        <tr>
            <td class="td_left_middle">
            </td>
            <td class="td_middle_middle">
                <div class="maincontent">
                    <form id="form1" runat="server">
                        <table cellpadding="0" cellspacing="0" style="width: 100%">
                            <tr>
                                <td class="td_title">
                                    收件人：</td>
                                <td class="td_content">
                                    <table>
                                        <tr>
                                            <td style="width: 280px;">
                                                <select id="selectUser" name="user" multiple="multiple" class="select">
                                                    <%Response.Write(UserBind()); %>
                                                </select>
                                            </td>
                                            <td style="text-align: center; width: 120px;">
                                                <input id="btnAllAdd" type="button" value="添加所有" title="添加所有会员" class="formButton" /><br />
                                                <br />
                                                <input id="btnAdd" type="button" value="添加选取" title="添加选取会员" class="formButton" /><br />
                                                <br />
                                                <input id="btnDelete" type="button" value="移除选取" title="移除选取会员" class="formButton" /><br />
                                                <br />
                                                <input id="btnAllDelete" type="button" value="移除所有" title="移除所有会员" class="formButton" />
                                            </td>
                                            <td>
                                                <select id="selectAddUser" name="addUser" multiple="multiple" class="select">
                                                </select>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td class="td_title">
                                    标题：</td>
                                <td class="td_content">
                                    <input id="txtTitle" type="text" runat="server" maxlength="20" />*最多20个字符</td>
                            </tr>
                            <tr>
                                <td class="td_title">
                                    内容：</td>
                                <td class="td_content">
                                    <textarea id="txtaContent" runat="server" cols="20" rows="2"></textarea>*最多4000个字符</td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <asp:Button ID="btnSubmit" runat="server" Text="确  定" CssClass="formButton" OnClick="btnSubmit_Click" />&nbsp;&nbsp;&nbsp;&nbsp;
                                    <input id="btnBack" type="button" class="formButton" value=" 返  回 " onclick="<%Response.Write(GetBcakLocation()); %>" /></td>
                            </tr>
                        </table>
                    </form>
                </div>
            </td>
            <td class="td_right_middle">
            </td>
        </tr>
        <tr>
            <td class="td_left_bottom">
                <img alt="" src="images/buttom_left2.gif" />
            </td>
            <td class="td_middle_bottom">
                <img alt="" src="images/buttom_bgs.gif" />
            </td>
            <td class="td_right_bottom">
                <img alt="" src="images/buttom_right2.gif" />
            </td>
        </tr>
    </table>
</body>
</html>
